home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Compilers / digital marsC compier / dm / include / dos.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-30  |  18.8 KB  |  671 lines

  1. /* Copyright (C) 1986-2001 by Digital Mars. $Revision: 1.1.1.2 $ */
  2. #if __SC__ || __RCC__
  3. #pragma once
  4. #endif
  5.  
  6. #ifndef __DOS_H
  7. #define __DOS_H 1
  8.  
  9. #if __cplusplus
  10. extern "C" {
  11. #endif
  12.  
  13. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  14. #ifndef _CRTAPI1
  15. #define _CRTAPI1 __cdecl
  16. #endif
  17.  
  18. /* Define _CRTAPI2 (for compatibility with the NT SDK) */
  19. #ifndef _CRTAPI2
  20. #define _CRTAPI2 __cdecl
  21. #endif
  22.  
  23. /* Define CRTIMP */
  24. #ifndef _CRTIMP
  25. #if defined(_WIN32) && defined(_DLL)
  26. #define _CRTIMP  __declspec(dllimport)
  27. #else
  28. #define _CRTIMP
  29. #endif
  30. #endif
  31.  
  32. #if __OS2__ && __INTSIZE == 4
  33. #define __CLIB  __stdcall
  34. #else
  35. #define __CLIB  __cdecl
  36. #endif
  37.  
  38. #if !(M_XENIX || M_UNIX)
  39. #pragma pack(1)
  40. #endif
  41.  
  42. #if !defined(_WCHAR_T_DEFINED)
  43. typedef unsigned short wchar_t;
  44. #define _WCHAR_T_DEFINED 1
  45. #endif
  46.  
  47. typedef unsigned size_t;
  48. extern unsigned __cdecl _stack;
  49.  
  50. #if defined(DOS386)
  51. extern unsigned short _x386_zero_base_selector;
  52. extern void *_x386_zero_base_ptr;  
  53. extern void __far *(*_x386_mk_protected_ptr)(unsigned long abs_address);
  54. extern int (*_x386_free_protected_ptr)(void __far *);
  55. extern unsigned long(*_x386_get_abs_address)(void __far *ptr);
  56. extern unsigned int (_x386_coreleft)(void);
  57. extern void* (_x386_map_physical_address)(void* abs_addr, unsigned size);
  58. extern int (_x386_memlock)(void __far *pointer, unsigned int length);
  59. extern int (_x386_memunlock)(void __far *pointer, unsigned int length);
  60. #endif
  61.  
  62. #ifndef __REGS_DEFINED
  63. #define __REGS_DEFINED
  64.  
  65. #if __INTSIZE == 4
  66.  
  67. #pragma pack(1)
  68. struct _DWORDREGS {unsigned eax,ebx,ecx,edx,esi,edi,cflag,flags;};
  69. #define DWORDREGS _DWORDREGS
  70.  
  71. struct _WORDREGS
  72. {       unsigned short  ax,eaxmsw,bx,ebxmsw,cx,ecxmsw,dx,edxmsw,
  73.             si,esimsw,di,edimsw;
  74.     unsigned cflag,flags;
  75. };
  76. #define WORDREGS _WORDREGS
  77.  
  78. struct _BYTEREGS
  79. {       unsigned char al,ah,ax2,ax3,bl,bh,bx2,bx3,
  80.               cl,ch,cx2,cx3,dl,dh,dx2,dx3;
  81. };
  82. #define BYTEREGS _BYTEREGS
  83.  
  84. union _REGS { struct _DWORDREGS e; struct _WORDREGS x; struct _BYTEREGS h; };
  85. #define REGS _REGS
  86.  
  87. struct _SREGS { unsigned short es,cs,ss,ds,fs,gs; };
  88. #define SREGS _SREGS
  89.  
  90. #pragma pack()
  91. #else /* __INTSIZE == 4 */
  92.  
  93. #pragma pack(1)
  94. struct WORDREGS { unsigned ax,bx,cx,dx,si,di,cflag,flags; };
  95. struct BYTEREGS {unsigned char al,ah,bl,bh,cl,ch,dl,dh; };
  96. union REGS { struct WORDREGS x; struct BYTEREGS h; };
  97. struct SREGS { unsigned es,cs,ss,ds; };
  98. #pragma pack()
  99. #define _REGS REGS
  100. #define _SREGS SREGS
  101. #define _WORDREGS WORDREGS
  102. #define _BYTEREGS BYTEREGS
  103.  
  104. #endif /* __INTSIZE==4 */
  105. #endif /* __REGS_DEFINED */
  106.  
  107. #ifndef __NT__
  108. #define disable() __emit__((char)(0xFA))
  109. #define _disable() __emit__((char)(0xFA))
  110. #define enable() __emit__((char)(0xFB))
  111. #define _enable() __emit__((char)(0xFB))
  112. #define geninterrupt(intr) __emit__(0xCD,(intr))
  113.  
  114. int __cdecl int86(int,union REGS *,union REGS *);
  115. int __cdecl int86x(int,union REGS *,union REGS *,struct SREGS *);
  116. int __cdecl intdos(union REGS *,union REGS *);
  117. int __cdecl intdosx(union REGS *,union REGS *,struct SREGS *);
  118. void __CLIB segread(struct SREGS *);
  119. #define _int86 int86
  120. #define _int86x int86x
  121. #define _intdos intdos
  122. #define _intdosx intdosx
  123. #define _segread segread
  124.  
  125. #if DOS386
  126. int __cdecl int86_real(int,union REGS *,union REGS *);
  127. int __cdecl int86x_real(int,union REGS *,union REGS *,struct SREGS *);
  128. #endif
  129. #endif
  130.  
  131. #if (M_UNIX || M_XENIX)
  132.  
  133. #define VTIOC           ('v' << 8)
  134. #define VT_OPENQRY      (VTIOC | 1)
  135. #define VT_SETMODE      (VTIOC | 2)
  136. #define VT_GETMODE      (VTIOC | 3)
  137. #define VT_RELDISP      (VTIOC | 4)
  138. #define VT_ACTIVATE (VTIOC | 5)
  139. #define VT_FALSE        0
  140. #define VT_TRUE         1
  141. #define VT_ACKACQ       2
  142. #define VT_AUTO         0
  143. #define VT_PROCESS      1
  144. struct vt_mode {char mode, waitv; short relsig, acqsig, frsig;};
  145. typedef int (*_vt_sig_func_t)(int);
  146. void _vt_get_mode(struct vt_mode *p);
  147. int _vt_set_mode(struct vt_mode *p);
  148. int _vt_get_num(void);
  149. int _vt_activate(int vt_num);
  150. int _vt_add(_vt_sig_func_t func);
  151. int _vt_remove(_vt_sig_func_t func);
  152.  
  153. #include <sys/stat.h>
  154.  
  155. #ifdef __NT__
  156. struct FINDW
  157. {
  158.     struct stat stat;
  159.     unsigned short attribute;
  160.     unsigned short time,date;
  161.     unsigned long size;
  162.     wchar_t name[16];
  163. };
  164. struct FINDA
  165. #else
  166. struct FIND
  167. #endif
  168. {
  169.     struct stat stat;
  170.     unsigned short attribute;
  171.     unsigned short time,date;
  172.     unsigned long size;
  173.     char name[16];
  174. };
  175.  
  176. #define FA_NORMAL       0x00
  177. #define FA_DIREC        S_IFDIR
  178.  
  179. #else           /* !M_UNIX */
  180.  
  181. #pragma pack(1)
  182.  
  183. #ifdef __NT__
  184. struct FINDW          /* struct used by wfindfirst() and wfindnext() */
  185. {       char reserved[21];        /* reserved by DOS                 */
  186.     char attribute;           /* attribute found (FA_XXXX)       */
  187.     unsigned short time,date; /* file's time and date            */
  188.     unsigned long size;       /* file's size                     */
  189. #if !defined(_WIN32)
  190.     wchar_t name[13];         /* filename followed by 0 byte     */
  191. #else
  192.     wchar_t name[260];
  193. #endif
  194. };
  195. struct FINDA            /* struct used by findfirst() and findnext()    */
  196. #else
  197. struct FIND             /* struct used by findfirst() and findnext()    */
  198. #endif
  199. {       char reserved[21];      /* reserved by DOS                      */
  200.     char attribute;         /* attribute found (FA_XXXX)            */
  201.     unsigned short time,date; /* file's time and date       */
  202.     unsigned long size; /* file's size              */
  203. #if !defined(_WIN32)
  204.     char name[13];          /* filename followed by 0 byte          */
  205. #else
  206.     char name[260];
  207. #endif
  208. };
  209.  
  210. struct find_t           /* used by _dos_findfirst() and _dos_findnext() */
  211. {       char reserved[21];      /* reserved by DOS                      */
  212.     char attrib;            /* attribute found (FA_XXXX)            */
  213.     unsigned short wr_time,wr_date; /* file's last write        */
  214.     unsigned long size; /* file's size              */
  215. #if !defined(_WIN32)
  216.     char name[13];          /* filename followed by 0 byte          */
  217. #else
  218.     char name[260];
  219. #endif
  220. };
  221.  
  222. #define _find_t find_t
  223. #pragma pack()
  224.  
  225. #define FA_NORMAL       0x00
  226. #define FA_RDONLY       0x01
  227. #define FA_HIDDEN       0x02
  228. #define FA_SYSTEM       0x04
  229. #define FA_LABEL        0x08
  230. #define FA_DIREC        0x10
  231. #define FA_ARCH         0x20
  232.  
  233. #define _A_NORMAL       0x00
  234. #define _A_RDONLY       0x01
  235. #define _A_HIDDEN       0x02
  236. #define _A_SYSTEM       0x04
  237. #define _A_VOLID        0x08
  238. #define _A_SUBDIR       0x10
  239. #define _A_ARCH         0x20
  240.  
  241. #endif
  242.  
  243. #ifdef __NT__
  244. #ifdef _UNICODE
  245. #define FIND        FINDW
  246. #else
  247. #define FIND        FINDA
  248. #endif
  249. struct FINDA * __CLIB findfirst(const char *,int);
  250. struct FINDA * __CLIB findnext(void);
  251. struct FINDW * __CLIB _wfindfirst (const wchar_t *, int);
  252. struct FINDW * __CLIB _wfindnext (void);
  253. #else
  254. struct FIND * __CLIB findfirst(const char *,int),* __CLIB findnext(void);
  255. #endif
  256.  
  257. #if defined(MSDOS) || (defined(_WINDOWS) && !defined(__NT__))
  258. unsigned __CLIB _dos_findfirst(const char *, unsigned, struct find_t *);
  259. unsigned __CLIB _dos_findnext(struct find_t *);
  260. #endif
  261.  
  262. #if defined(MSDOS)
  263. void __CLIB _dos_keep(unsigned, unsigned);
  264. #endif
  265.  
  266. #ifndef __NT__
  267. #define _FP_OFF(fp) (*((unsigned __far *)&(fp)))
  268. #define FP_OFF _FP_OFF
  269.  
  270. #if __INTSIZE == 4
  271. extern unsigned __CLIB FP_SEG(void __far *);
  272. #define _FP_SEG FP_SEG
  273. #else
  274. #define _FP_SEG(fp) (*((unsigned __far *)&(fp)+1))
  275. #define FP_SEG _FP_SEG
  276. #endif
  277. #if __INTSIZE == 4
  278. extern void __far * __CLIB MK_FP(unsigned short,unsigned);
  279. #define MK_FP(seg,offset) MK_FP((seg),(unsigned)(offset))
  280. #else
  281. #define MK_FP(seg,offset) \
  282.     ((void __far *)(((unsigned long)(seg)<<16) | (unsigned)(offset)))
  283. #endif
  284. #endif
  285.  
  286. #define _MK_FP MK_FP
  287.  
  288. #if __INTSIZE == 2
  289. void __far * __cdecl farmalloc(unsigned long size);
  290. void __far * __cdecl farcalloc(unsigned long numelems,unsigned long elemsize);
  291. void __far * __cdecl farrealloc(void __far *oldptr,unsigned long newsize);
  292. int __cdecl farfree(void __far *ptr);
  293. unsigned long __cdecl farcoreleft(void);
  294. #endif
  295.  
  296. #pragma pack(1)
  297. struct DOSERROR
  298. {
  299.     int exterror;   /* extended error code */
  300.     char eclass;            /* error class */
  301.     char action;    /* recommended action */
  302.     char locus;             /* error locus */
  303. };
  304. #define _DOSERROR DOSERROR
  305. #define errclass eclass
  306.  
  307. struct  COUNTRY {
  308.     short   co_date;
  309.     char    co_curr[5];
  310.     char    co_thsep[2];
  311.     char    co_desep[2];
  312.     char    co_dtsep[2];
  313.     char    co_tmsep[2];
  314.     char    co_currstyle;
  315.     char    co_digits;
  316.     char    co_time;
  317.     long    co_case;
  318.     char    co_dasep[2];
  319.     char    co_fill[10];
  320. };
  321.  
  322. struct diskfree_t {
  323.     unsigned total_clusters;
  324.     unsigned avail_clusters;
  325.     unsigned sectors_per_cluster;
  326.     unsigned bytes_per_sector;
  327. };
  328. #define _diskfree_t diskfree_t
  329.  
  330. struct dos_date_t
  331. {
  332.     unsigned char day;
  333.     unsigned char month;
  334.     unsigned short  year;
  335.     unsigned char dayofweek;
  336. };
  337. #define _dosdate_t dos_date_t
  338.  
  339. struct  _fatinfo
  340. {
  341.     char            fi_sclus;
  342.     char            fi_fatid;
  343.     unsigned        fi_nclus;
  344.     int             fi_bysec;
  345. };
  346. #define fatinfo _fatinfo
  347.  
  348. struct dos_time_t
  349. {
  350.     unsigned char hour;
  351.     unsigned char minute;
  352.     unsigned char second;
  353.     unsigned char hsecond;
  354. };
  355. #define _dostime_t dos_time_t
  356.  
  357. struct time
  358. {
  359.     unsigned char   ti_min;
  360.     unsigned char   ti_hour;
  361.     unsigned char   ti_hund;
  362.     unsigned char   ti_sec;
  363. };
  364.  
  365. struct date
  366. {
  367.     int da_year;
  368.     char    da_day;
  369.     char    da_mon;
  370. };
  371.  
  372. struct fcb
  373. {
  374.     char    fcb_drive;
  375.     char    fcb_name[8];
  376.     char    fcb_ext[3];
  377.     short   fcb_curblk;
  378.     short   fcb_filesize;
  379.     short   fcb_date;
  380.     char    fcb_resv[10];
  381.     char    fcb_crrec;
  382.     long    fcb_random;
  383. };
  384.  
  385. #pragma pack()
  386.  
  387. #ifndef __NT__
  388. struct COUNTRY *__CLIB  country( int , struct COUNTRY *);
  389. extern unsigned int __CLIB _osversion;
  390. #ifndef DOS386
  391. int __CLIB              getcbrk(void);
  392. void __CLIB             ctrlbrk(int (*FarPtr)());
  393. int __CLIB              setcbrk(int value);
  394. void __CLIB             getfat(unsigned char disk, struct fatinfo *fat);
  395. void __CLIB             getfatd(struct fatinfo *fat);
  396. int __CLIB              getverify(void);
  397. void __CLIB             setverify(int value);
  398. char __far * __CLIB     getdta(void);
  399. void __CLIB             setdta(char __far *dta);
  400. unsigned __CLIB         getpsp(void);
  401. int __CLIB              setblock(unsigned segment, unsigned size);
  402. char * __CLIB           parsfnm(const char *cmdline, struct fcb *fcb, int opt);
  403. #endif /* DOS386 */
  404. #endif /* __NT__ */
  405.  
  406. #ifndef DOS386
  407. void __CLIB             getdate(struct date *datePtr);
  408. void __CLIB             gettime(struct time *timePtr);
  409. #endif
  410.  
  411. unsigned __CLIB         _dos_lock(int, int, unsigned long, unsigned long);
  412. unsigned long __CLIB    _dos_seek(int, unsigned long, int);
  413. int __CLIB              dos_creat(char *,int);
  414. int __CLIB              _dos_creat(const char *,unsigned, int *);
  415. int __CLIB              _dos_creatnew(const char *,unsigned , int *);
  416. unsigned __CLIB         _dos_open(const char *, unsigned,int *);
  417. int __CLIB              dos_close(int);
  418. unsigned __CLIB         _dos_read(int, void __far *,unsigned,unsigned *);
  419. unsigned __CLIB         _dos_write(int, const void __far *,unsigned,unsigned *);
  420. int __CLIB              dos_get_ctrl_break(void);
  421. #ifndef DOS386
  422. int __CLIB              dos_abs_disk_read(int,int,long,char *);
  423. int __CLIB              dos_abs_disk_write(int,int,long,const char *);
  424. #endif
  425. void __CLIB             dos_set_verify(int);
  426. void __CLIB             dos_set_ctrl_break(int);
  427. int __CLIB              dos_get_verify(void);
  428. int __CLIB              getcurdir(int drive,char *dir);
  429. char * __CLIB           _getdcwd(int drive,char *Pbuf,int PbufLen);
  430. unsigned __CLIB         _dos_commit(int);
  431. int __CLIB              dos_exterr(struct DOSERROR *);
  432. int __CLIB              dosexterr(struct DOSERROR *);
  433. int __CLIB              setdisk(int);
  434. int __CLIB              getdisk(void);
  435. long __CLIB             dos_getdiskfreespace(int);
  436. unsigned __CLIB         _dos_getdiskfree(unsigned, struct diskfree_t *);
  437. void __CLIB             dos_setdrive(unsigned, unsigned *);
  438. void __CLIB             dos_getdrive(unsigned *);
  439. unsigned __CLIB         dos_setftime(int, unsigned, unsigned);
  440. unsigned __CLIB         dos_getftime(int, unsigned *, unsigned *);
  441. unsigned __CLIB         dos_setfileattr(const char *, unsigned);
  442. unsigned __CLIB         dos_getfileattr(const char *, unsigned *);
  443. unsigned __CLIB         dos_setdate(struct dos_date_t *);
  444. void __CLIB             dos_getdate(struct dos_date_t *);
  445. int __CLIB              _dos_sethandlecount(unsigned);
  446. unsigned __CLIB         dos_settime(struct dos_time_t *);
  447. void __CLIB             dos_gettime(struct dos_time_t *);
  448.  
  449. #define absread(drive,nsects,lsects,buffer) dos_abs_disk_read(drive,nsects,lsects,buffer)
  450. #define abswrite(drive,nsects,lsects,buffer) dos_abs_disk_write(drive,nsects,lsects,buffer)
  451. #define _dosexterr(dosstruct) dos_exterr(dosstruct)
  452. #define _dos_close dos_close
  453.  
  454. #if __INTSIZE == 2
  455. unsigned                _dos_allocmem(unsigned int,unsigned int *);
  456. int                     allocmem(unsigned int,unsigned int *);
  457. unsigned                _dos_freemem(unsigned);
  458. int                     freemem(unsigned);
  459. #endif
  460.  
  461. #define _dos_getdate dos_getdate
  462. #define _dos_getdrive dos_getdrive
  463. #define _dos_getfileattr dos_getfileattr
  464. #define _dos_getftime dos_getftime
  465. #define _dos_gettime dos_gettime
  466. #define _dos_setdate dos_setdate
  467. #define _dos_setdrive dos_setdrive
  468. #define _dos_setfileattr dos_setfileattr
  469. #define _dos_setftime dos_setftime
  470. #define _dos_settime dos_settime
  471.  
  472. unsigned char   __CLIB _inp(unsigned);
  473. unsigned short  __CLIB _inpw(unsigned);
  474. unsigned long   __CLIB _inpl(unsigned);
  475.  
  476. unsigned char   __CLIB _outp(unsigned,unsigned char);
  477. unsigned short  __CLIB _outpw(unsigned,unsigned short);
  478. unsigned long   __CLIB _outpl(unsigned,unsigned long);
  479.  
  480. unsigned char   __CLIB _inline_inp(unsigned);
  481. unsigned short  __CLIB _inline_inpw(unsigned);
  482. unsigned long   __CLIB _inline_inpl(unsigned);
  483.  
  484. unsigned char   __CLIB _inline_outp(unsigned,unsigned char);
  485. unsigned short  __CLIB _inline_outpw(unsigned,unsigned short);
  486. unsigned long   __CLIB _inline_outpl(unsigned,unsigned long);
  487.  
  488. #define _inp(x)        _inline_inp(x)
  489. #define _inpw(x)        _inline_inpw(x)
  490. #define _outp(x,y)      _inline_outp(x,y)
  491. #define _outpw(x,y)    _inline_outpw(x,y)
  492.  
  493. #if __INTSIZE == 4
  494. #define _inpl(x)        _inline_inpl(x)
  495. #define _outpl(x,y)    _inline_outpl(x,y)
  496. #endif
  497.  
  498. // Obsolete, use the _ prefixed versions
  499. #define inp(x)          _inline_inp(x)
  500. #define inpw(x)         _inline_inpw(x)
  501. #define outp(x,y)       _inline_outp(x,y)
  502. #define outpw(x,y)      _inline_outpw(x,y)
  503.  
  504. #if !(defined (_WINDOWS) || defined (__NT__))
  505.  
  506. #define _HARDERR_IGNORE 0
  507. #define _HARDERR_RETRY  1
  508. #define _HARDERR_ABORT  2
  509. #define _HARDERR_FAIL   3
  510.  
  511. void __cdecl _harderr (void (__far __cdecl *) (unsigned, unsigned, unsigned __far *));
  512. void __cdecl _hardresume (int);
  513. void __cdecl _hardretn (int);
  514.  
  515. #endif /*!(defined (_WINDOWS) || defined (__NT__))*/
  516.  
  517. size_t __CLIB _chkstack(void);
  518.  
  519. #ifndef __NT__
  520.  
  521. #define interrupt __interrupt
  522.  
  523. void __cdecl peekbytes(unsigned,unsigned,void *,size_t);
  524. void __cdecl pokebytes(unsigned,unsigned,const void *,size_t);
  525. #if __cplusplus
  526. void inline poke(unsigned segm, unsigned offs, int value)
  527. {
  528.     *((int __far *) MK_FP(segm, offs)) = value;
  529. }
  530.  
  531. int inline peek(unsigned segm, unsigned offs)
  532. {
  533.     return *((int __far *) MK_FP(segm, offs));
  534. }
  535. void inline pokeb(unsigned segm, unsigned offs, char value)
  536. {
  537.     *((char __far *) MK_FP(segm, offs)) = value;
  538. }
  539.  
  540. char inline peekb(unsigned segm, unsigned offs)
  541. {
  542.     return *((char __far *) MK_FP(segm, offs));
  543. }
  544. #else
  545. #define peek(segm, offs) (*((int __far *) MK_FP((segm), (offs))))
  546. #define peekb(segm, offs) (*((char __far *) MK_FP((segm), (offs))))
  547. #define poke(segm, offs, value) (*((int __far *) MK_FP((segm), (offs))) = (int)(value))
  548. #define pokeb(segm, offs, value) (*((char __far *) MK_FP((segm), (offs))) = (char)(value))
  549. #endif
  550.  
  551. #ifndef _WINDOWS
  552. #ifndef DOS386
  553. void __CLIB _chain_intr (void (__interrupt __far * funcptr)());
  554. void (__interrupt __far * __CLIB _dos_getvect(unsigned vector))();
  555. void __CLIB _dos_setvect (unsigned vector, 
  556.               void (__interrupt __far * funcptr)());
  557. #if __cplusplus
  558. void inline (__interrupt __far * getvect(int vector))()
  559. {
  560.    return _dos_getvect (vector);
  561. }
  562. void inline setvect(int vector, void (__interrupt __far * funcptr)())
  563. {
  564.    _dos_setvect(vector, funcptr);
  565. }
  566. #else
  567. #define getvect _dos_getvect
  568. #define setvect _dos_setvect
  569. #endif
  570. #endif /* DOS386 */
  571. #endif
  572.  
  573. int __cdecl bdos(int dosfunc, unsigned int dosdx, unsigned int dosal);
  574. #define _bdos bdos
  575. int __cdecl bdosptr(int, void *, unsigned);
  576. int __cdecl bdosx(char,void *,char);
  577.  
  578. #ifndef DOS386
  579. unsigned __CLIB dos_alloc(unsigned);
  580. unsigned __CLIB dos_calloc(unsigned);
  581. int __CLIB dos_free(unsigned);
  582. #endif /* DOS386 */
  583. void __CLIB _copy(unsigned,unsigned,unsigned);
  584. unsigned long __CLIB dos_avail(void);
  585. #ifndef DOS386
  586. unsigned __CLIB dos_setblock(unsigned,unsigned);
  587. unsigned __CLIB _dos_setblock(unsigned,unsigned,unsigned *);
  588. #endif /* DOS386 */
  589.  
  590. #endif
  591.  
  592. int __pascal response_expand(int *,char ***);
  593.  
  594. int __CLIB cputype(void);
  595.  
  596. #ifndef _WIN32
  597. # if defined(ZTC_COMPAT)
  598. #  if !(M_UNIX || M_XENIX)
  599. #   if !__cplusplus
  600. #define WILDCARDS  extern int __cdecl __wildcard; int *__wild = &__wildcard;  
  601. #   else
  602. #define WILDCARDS  extern "C" { extern int __cdecl __wildcard; int *__wild = &__wildcard; }
  603. #   endif
  604. #  else
  605. #define WILDCARDS
  606. #  endif
  607. # else
  608. #  if !(M_UNIX || M_XENIX)
  609. #   if !__cplusplus
  610. #define EXPAND_WILDCARDS  extern int __cdecl __wildcard; int *__wild = &__wildcard;  
  611. #   else
  612. #define EXPAND_WILDCARDS  extern "C" { extern int __cdecl __wildcard; int *__wild = &__wildcard; }
  613. #   endif
  614. #  else
  615. #define EXPAND_WILDCARDS
  616. #  endif
  617. # endif
  618. #else
  619. # if !(M_UNIX || M_XENIX)
  620. #  if !__cplusplus
  621. #define WILDCARDS        int __cdecl __wildcard = 1;
  622. #define EXPAND_WILDCARDS    int __cdecl __wildcard = 1;
  623. #  else 
  624. #define WILDCARDS extern "C" { int __cdecl __wildcard = 1; }
  625. #define EXPAND_WILDCARDS extern "C" { int __cdecl __wildcard=1; }
  626. #  endif
  627. # else
  628. #define WILDCARDS
  629. #define EXPAND_WILDCARDS
  630. # endif
  631. #endif
  632.  
  633. #define EXE_DOS         1
  634. #define EXE_DOS16RM     2
  635. #define EXE_ZPM         4
  636. #define EXE_PHAR386     8
  637. #define EXE_DOSX        0x10
  638. #define EXE_WINDOWS     0x20
  639. #define EXE_OS2         0x40
  640. #define EXE_SCOUNIX     0x80
  641. #define EXE_OS2_2       0x100
  642. #define EXE_WINDOWSNT   0x200
  643.  
  644. extern unsigned short __cdecl _exe_type;
  645.  
  646. #if !(M_UNIX || M_XENIX)
  647. #pragma pack()
  648. #endif
  649.  
  650. #ifdef _WINDOWS
  651. extern void __far __pascal DOS3CALL(void);
  652. #define int21h  __asm   call    DOS3CALL
  653. #else
  654. #define int21h  __asm   int 21h
  655. #endif
  656.  
  657. #if __cplusplus
  658. inline unsigned _getdiskfree(unsigned driveno, struct _diskfree_t *diskspace)
  659. {
  660.     return _dos_getdiskfree(driveno, diskspace); /*needed for MSVCNT compatibility*/
  661. }
  662. #else
  663. #define _getdiskfree _dos_getdiskfree   /*needed for MSVCNT compatibility*/
  664. #endif
  665.  
  666. #if __cplusplus
  667. }
  668. #endif
  669.  
  670. #endif
  671.